def Type():

    s1 = 'a*dsa@#'
    print(s1.isalnum())
    s2 = '123'
    print(s2.isdecimal())

def Find():

    s1 = 'abcdefgacdeaaaf'
    print(s1.find('a', 3)) #返回起始下标
    s2 = s1.replace('a', 'A', 2)
    print(s2)


def SplitJoin():

    s1 = '123 hkh @#$! 拿返点'
    print(s1.split())
    s1 = '123 hkh @#$! 拿返点'
    print(s1.split(','))

    print('#' * 50)
    str_list = [1,2,'sa','@#$']
    print(','.join(str_list))

def Slice():

    num_str = 'abcdefghijklmnopqrst'
    print(num_str[2:6])  #2~5,左闭右开

    print(num_str[1:])  #1到结束

    print(num_str[:6])  #0~5

    print(num_str[:])   #全部

    print(num_str[::2])  #从0开始，间隔两个取一个

    print(num_str[1::2])  #从1开始，间隔两个取一个

    print(num_str[-1])   #从最后一个开始

    print(num_str[1:-1])  #从1到最后

    print(num_str[-2:])   #最后两个字符

    print(num_str[::-1])   #字符串逆序

def ListSlice():

    list1 = list('abcdefghijklmnopqrst')
    print(list1)
    print(list1[1:])   #从1到最后

def Count():

    s1 = '122112232423321'

    print(len(s1))   #s1的长度

    print(s1.count('12'))  #‘12’出现的次数
    print(s1.count('33'))

    print(s1.index('23'))  #'23'出现的索引

if __name__ == '__main__':
    # Type()
    # Find()
    # SplitJoin()
    # Slice()
    # ListSlice()
    Count()